<div class="vista_toolbar">
  <ul>
    <%= toolbar_add 'tarjous', 'quotes', customer %>
    <%= toolbar_delete_selected 'quotes' %>
  </ul>
</div>
<%form_remote_tag :url => destroy_selected_quotes_url, :confirm => 'Haluatko varmasti poistaa tarjoukset?', :before => "spinnerOn('quotes');", :complete => "spinnerOff('quotes');", :method => :delete, :html => { :id => 'quotes_form'} do %><%if customer.quotes.empty? %>
    <div class="container">
      Tarjouksia ei ole.
    </div>
  <%else %>
    <div class="scrollable" style="height:15em">
      <%customer.quotes.each do |quote| %>
        <div class="container">
          <div style="float:right">
            <%=icon_edit 'quotes', quote %>
            <%=checkbox_delete_selected 'quotes', quote.id %>
          </div>
          <%=content_tag :div, "#{quote.quote_number} / #{quote.created_on}", :class => 'quote_number', :onclick => visual_effect(:toggle_blind, "quote_details_" + quote.id.to_s, :duration => 1.0) %><%=content_tag :div, quote.description, :class => 'description' %>
          <br/>
          <div style="display:none" id="quote_details_<%=quote.id%>">
            <% if !quote.price_per_hour.nil? %>
              <%=content_tag :div, 'Tuntihinta:', :class => 'item_title' %><%=h quote.price_per_hour %>
              <br/>
            <% end %>
            <% if !quote.hours.nil? %>
              <%=content_tag :div, 'Tunteja:', :class => 'item_title' %><%=h quote.hours %>
              <br/>
            <% end %>
            <% if !quote.total_price.nil? %>
              <%=content_tag :div, 'Kokonaishinta:', :class => 'item_title' %><%=h quote.total_price %>
              <br/>
            <% end %>
            <br/>
            <%=content_tag :div, 'Dokumentit:', :class => 'item_title_no_float' %>
            <p>
              <%quote.documents.each do |document| %>
                <%=link_to document.filename, {:controller => 'documents', :action => 'view', :id => document}, :popup => true, :html => {:class => 'file'} %>
                <% if authorized? 'quotes', 'remove_document' %>
                  <%=link_to_remote image_tag('cross.png', :title => 'Poista'), :url => {:controller => 'quotes', :action => 'remove_document', :id => quote, :document => document}, :confirm => 'Haluatko varmasti poistaa dokumentin?' %>
                <% end %>
                <br/>
              <%end %>
            </p>
            <% if authorized? 'quotes', 'new_document' %>
              <%= link_to_remote '[Lisää tiedosto...]',  :url=> {:controller => 'quotes', :action => 'new_document', :id => quote} %><br/>
            <% end %>
            <br/>
            <%=content_tag :div, 'Resurssit:', :class => 'item_title_no_float' %>
            <p>
              <%quote.resources.each do |employee| %>
                <%=h employee.full_name %>
                <% if authorized? 'quotes', 'remove_resource' %>
                  <%=link_to_remote image_tag('cross.png', :title => 'Poista'), :url => {:controller => 'quotes', :action => 'remove_resource', :id => quote, :resource => employee}, :confirm => 'Haluatko varmasti poistaa resurssin?' %>
                <% end %>
                <br/>
              <% end %>
            </p>
            <% if authorized? 'quotes', 'select_resource' %>
              <%= link_to_remote '[Lisää resurssi...]',  :url=> {:controller => 'quotes', :action => 'select_resource', :id => quote} %>
            <% end %>
          </div>
          <div style="clear:both">
          </div>
        </div>
      <%end %>
    </div>
  <%end %>
<%end %>